import { createRouter, createWebHashHistory } from 'vue-router';
import HomeView from '../views/HomeView.vue';
import newOrEditView from '../views/NewOrEditView.vue';
import HomeSPTGView from '../views/HomeSPTGView.vue';
import HomeYGDView from '../views/HomeYGDView.vue';
import HomeMaintainSpView from '../views/HomeMaintainSpView.vue';

import NormalRouterView from '../views/NormalRouterView.vue';
import spRecordView from '../views/SpRecordView.vue';

import uploadZLMatView from '../views/uploadZLMatView.vue';

const routes = [
  {
    path: "/sp",
    name: "sp",
    component: NormalRouterView,
    meta: {
      routers: [
        {
          link: '/sp/newOrEdit',
          text: '申请&审批',
        },
        {
          link: '/sp/spRecord',
          text: '审批记录',
        },
      ],
    },
    children: [
      {
        path: "/sp/newOrEdit",
        name: "newOrEdit",
        component: newOrEditView,
      },
      {
        path: "/sp/spRecord",
        name: "spRecord",
        component: spRecordView,
      },
    ],
  },

  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children: [
      {
        path: '/',
        component: HomeSPTGView,
      },
      {
        path: 'homeSPTG',
        name: 'homeSPTG',
        component: HomeSPTGView,
      },
      {
        path: 'homeYGD',
        name: 'homeYGD',
        component: HomeYGDView,
      },
      {
        path: 'homeMaintainSp',
        name: 'homeMaintainSp',
        component: HomeMaintainSpView
      },
    ]
  },
  {
    path: '/uploadZL',
    name: 'uploadZL',
    component: uploadZLMatView,

  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes
});

export default router;
